<% #endcoding:utf-8%>

    <%=form_for :search,url:'/searchs',:html=>{:method=>"GET",:class=>"navbar-form navbar-left",:role=>"search",:id=>"searchbox"} do |f|%>
        <div class="form-group">
          <input type="text" class="form-control" placeholder="需求 问答 用户" name="kw">
        </div>
        <button type="Submit" class="btn btn-default"></button>
        <span class="search-btn glyphicon glyphicon-search"></span>
    <% end %>

<script>
  $("#searchbox input").focus(function(){
      $('#top-nav').hide();
      $(this).animate({width:"420px"});
  }).blur(function(){
      $(this).animate({width:"199px"});
      $('#top-nav').show();
  }).keydown(function(e){
      if(e.keyCode===13){
          $('#searchbox').submit();
      }
  });
</script>